#pragma once
#include <time.h>
#ifndef LINUX
	#include <winsock.h>
#endif

namespace MonsterFactory {

  enum ClockStatus {
    TIC,
    TOC,
    NA
  };
  
  class Clock {
  private:
    Clock(){}
    ~Clock(){}    
    Clock(const Clock&) {};
    Clock& operator=(const Clock&) {}

    static Clock* instance;
    struct timeval start, end;
    enum ClockStatus status;

    class Garbo
    {
    public:
      ~Garbo()
      {
	if(Clock::instance != NULL  )
	  {
	    delete Clock::instance;
	    Clock::instance = NULL;
	  }
      }
    };
    static Garbo garbo;
    
  public:
    static Clock* GetInstance() {
      if (instance == NULL)
	instance = new Clock();
      return instance;
    }
    void Tic();
    void Toc();
    double GetDuration();
  };
}
